<%@ page language="java" errorPage="../error/exceptionHandler.jsp"%><%@ page import="java.sql.*"%><%@ page import="org.apache.log4j.Logger"%><%@ page import="org.cgs.web.database.DatabaseConnector"%><%        Logger LOGGER = Logger.getLogger("deleteInstructor.jsp");%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-AU">	<head>		<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />		<link rel="stylesheet" type="text/css" href="../css/sinorca-screen.css" media="screen" title="Sinorca (screen)" />		<link rel="stylesheet alternative" type="text/css" href="../css/sinorca-screen-alt.css" media="screen" title="Sinorca (alternative)" />		<link rel="stylesheet" type="text/css" href="../css/sinorca-print.css" media="print" />		<title>Instructor Main Page</title>			<script type="text/javascript">
			function confirmSubmit()
			{
			if (confirm("Are you sure you want to delete this instructor?"))
				return true ;
			else
				return false ;
			}
		</script>	</head><body><div id="top"><a href="#main-copy" class="doNotDisplay doNotPrint">Skip to main content.</a></div><div id="header"><div class="superHeader"></div><div class="midHeader"><h1 class="headerTitle">Course Group Scheduler 3.0</h1></div></div><!-- ##### Side Bar ##### --><div id="side-bar"><div><p class="sideBarTitle">Admin Menu</p><ul>	<li><a href="addInstructor.jsp">Add Instructors</a></li>	<li><a href="viewInstructors.jsp">View Instructors</a></li></ul></div></div><!-- ##### Main Copy ##### --><div id="main-copy"><h1 id="introduction">Welcome</h1><p></p><form name="f" method="post" action="/cgs/DeleteInstructor" onsubmit="return confirmSubmit()"><table>	<tr>		<td>&nbsp;</td>		<td>Username</td>		<td>Password</td>		<td>Course Code</td>	</tr>	<%
	     Connection con = null;
	     Statement stmt = null;
	     ResultSet rs = null;

	     try
	     {
                con = DatabaseConnector.getInstance().getConnection();
	        stmt = con.createStatement();
	        rs = stmt.executeQuery("SELECT * FROM instructorAuthorization ORDER BY netID");

	       while(rs.next())
	       {
	        String courseCode = rs.getString("courseCode");
	        String username = rs.getString("netID");
		String password = rs.getString("password");
 	%>	<tr>		<td><input type="checkbox" name="username" value="<%=username%>" /></td>		<td><a href="instructor.jsp?courseCode=<%= courseCode %>&amp;netID=<%=username%>"><%= username %></a></td>		<td><%= password %></td>		<td><%= courseCode %></td>	</tr>	<%
	       } 
	    }
	    catch(Exception e)
	    {
                LOGGER.error("Exception thrown while atttempting to delete an instructor from DB", e);
	    }
	    finally
	    {
            try
            {
                // Close the ResultSet
                if (rs != null)
                {
                    rs.close();
                }
            }
            catch (Exception e)
            {
                LOGGER.error("Exception cleaning up result set", e);
            }

            try
            {
                // Close the PreparedStatement
                if (stmt != null)
                {
                    stmt.close();
                }
            }
            catch (Exception e)
            {
                LOGGER.error("Exception cleaning up prepared statement", e);
            }

            try
            {
                // Close the connection
                if (con != null)
                {
                    con.close();
                }
            }
            catch (Exception e)
            {
                LOGGER.error("Exception cleaning up connection to the database", e);
            }
	    }
	%></table><input type="Submit" value="Delete" /></form><a class="topOfPage" href="#top" title="Go to the top of this page">^ TOP</a> <!-- ##### Footer ##### --><div id="footer">E-mail:&nbsp;<a href="./index.html" title="Email webmaster">jeffrey.s.garrett@gmail.com</a></div></div></body></html>